package org.jeecg.modules.demo.sysuser.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.demo.sysuser.entity.SysUser;
import org.jeecg.modules.demo.sysuser.mapper.SysUserOldMapper;
import org.jeecg.modules.demo.sysuser.service.ISysUserService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Description: sys_user
 * @Author: jeecg-boot
 * @Date:   2025-04-27
 * @Version: V1.0
 */
@DS("multi-datasource1")
@Service
public class SysUserOldServiceImpl extends ServiceImpl<SysUserOldMapper, SysUser> implements ISysUserService {

    @Override
    public String genrateSysUserId(String text) {
        return baseMapper.genrateSysUserId(text);
    }

    @Override
    @Transactional
    public boolean updateById(SysUser entity) {
        SysUser user = this.getById(entity.getId());
        if(user == null) {
            System.out.println("记录不存在！");
            log.error("ID为{}的记录不存在");
        }
        return super.updateById(entity);
    }
}
